package com.lipstick.app;


/**
 * This class represents a final price calculator, based on a discount.
 * 
 * @author lipstick_team
 *
 */
public class Calculator {
	
	//The full price of the item
	private float fullPrice;
	//discount.
	private int discount;
	//The item final price, after applied the discoun.
	private float finalPrice;
	//Implementacao Singleton
	private static Calculator instance;
	
	
	/**
	 * For Singleton implementation.
	 * 
	 * @return the unique instance of the calculator.
	 */
	public static Calculator getInstance(){
		if (instance == null){
			instance = new Calculator();
		}
		return instance;
	}
	
	public void setDiscount(int discount) {
		this.discount = discount;
		this.finalPrice = this.fullPrice - ((this.fullPrice*discount)/100);
	}
	
	public void setFinalPrice(float finalPrice) {
		this.finalPrice = finalPrice;
	}
	
	public void setFullPrice(float fullPrice) {
		this.fullPrice = fullPrice;
	}
	
	public int getDiscount() {
		return discount;
	}
	
	public float getFinalPrice() {
		return finalPrice;
	} 
	
	public float getFullPrice() {
		return fullPrice;
	}

}
